<?php


namespace App\Commons\Domain\Module\System\Service;


use App\Commons\Domain\Core\DomainService;
use App\Commons\Domain\Module\System\Contract\SystemService as SyService;
use App\Commons\Domain\Module\System\Model\Country;

class SystemService extends DomainService implements SyService
{
    /**
     * 创建国家地区
     * @param string $zh_name
     * @param string $en_name
     * @param string $area_code
     * @param string $language
     * @param string $currency
     * @param int $sort_num
     * @return Country
     */
    public function createCountry(
        string $zh_name,
        string $en_name,
        string $area_code,
        string $language,
        string $currency,
        int $sort_num
    ) {
        throw_on(Country::where(['zh_name' => $zh_name])->first(), 0x600002);
        return Country::create(compact('zh_name', 'en_name', 'area_code', 'language', 'currency', 'sort_num'));
    }

}
